How can I ceate new array of elements based on a pattern found in another array

join shbcf.ru